package com.suixun.entity.ext.credits.company;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;

import com.suixun.entity.ext.credits.BaseEntity;

/**
 * 商户详情中的商品列表
 * 
 * @author yh
 * @date 2017年12月15日
 */
public class CompanyGoodsPage extends BaseEntity {

    /**
     * 商品档案序列号
     */
    private String uuid;

    /**
     * 需要消耗的积分数
     */
    private Integer consumeCredit;

    /**
     * 商品市场价
     */
    private BigDecimal price;

    /**
     * 总库存
     */
    private Integer totalNum;

    /**
     * 销量
     */
    private Integer consumeNum;

    /**
     * 商品所有投放区域的投放对象 多个用','分割
     */
    private String putRanges;

    /**
     * 商品所有投放区域的投放对象显示值
     */
    private String putRangesShow;

    public String getUuid() {
        return uuid;
    }

    public void setUuid(String uuid) {
        this.uuid = uuid;
    }

    public Integer getConsumeCredit() {
        return consumeCredit;
    }

    public void setConsumeCredit(Integer consumeCredit) {
        this.consumeCredit = consumeCredit;
    }

    public Integer getTotalNum() {
        return totalNum;
    }

    public void setTotalNum(Integer totalNum) {
        this.totalNum = totalNum;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public Integer getConsumeNum() {
        return consumeNum;
    }

    public void setConsumeNum(Integer consumeNum) {
        this.consumeNum = consumeNum;
    }

    public String getPutRanges() {
        return putRanges;
    }

    public void setPutRanges(String putRanges) {
        this.putRanges = putRanges;
    }

    public String getPutRangesShow() {
        if (StringUtils.isEmpty(putRanges)) {
            putRangesShow = "未投放";
        } else {
            String[] ranges = putRanges.split(",");
            List<String> list = new ArrayList<>();
            for (String s : ranges) {
                switch (Integer.parseInt(s)) {
                case 0:
                    list.add("所有");
                    break;
                case 1:
                    list.add("教师");
                    break;
                case 2:
                    list.add("家长");
                    break;
                }
            }
            putRangesShow = StringUtils.join(list, ",");
        }
        return putRangesShow;
    }

    public void setPutRangesShow(String putRangesShow) {
        this.putRangesShow = putRangesShow;
    }

}
